<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>v-on实例</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
    <h1>v-on实例</h1>
    <hr>
    <div id="app">
       本场比赛得分:{{fenshu}}
       <p>
           <button v-on:click="jiafen">加分</button>
           <button @click="jiafen">减分</button><br/>
           <input type="text" @keyup.enter="onEnter" v-model="fenshu2">//enter=13
       </p>
    </div>
    <script type="text/javascript">
    var app=new Vue({
        el:'#app',
        data:{
            fenshu:0,
            fenshu2:2
        },
        methods:{
            jiafen:function(){
                this.fenshu++;
            },
            jianfen:function(){
                this.fenshu--;
            },
            onEnter:function(){
                this.fenshu=this.fenshu+parseInt(this.fenshu2)
            }

        }
    })
    </script>
</body>
</html>